<?php
namespace Lib;
use Lib;
use mysqli;
use config\db_config;
require_once __DIR__ .'/../config/db_config.php';
class mydb {
    public static $db;
    public function __construct() {
        $address= db_config::$DB_ADDRESS;
        $username=db_config::$DB_USER;
        $password= db_config::$DB_PASSWORD;
        try {
            if(self::$db==null){
                self::$db=new mysqli($address, $username, $password, db_config::$DB_NAME);
                self::$db->query ( "set names utf8" );
            }
            
        } catch (PDOException $e) {
            die ("Error!: " );
        }
    }
    public  function exec($param) {
        return self::$db->query($param);
    }
    public  function qurey($param) {
        $res=self::$db->query($param);
        return $res;
    }
}